<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="../../common/includeBaseSet.jsp" %>
<%@include file="../../common/operation_forbid.jsp" %>
<%@include file="../../common/jsVersion.jsp" %>
<!DOCTYPE html >
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>房源销控</title>
 	<style type="text/css">
 		.tableCss{width:500px;height:100px;border:1px solid #ddd;font-size:12px;background-color:transparent;border-spacing:0;border-collapse:collapse;border-radius:0!important}
 		.tableCss td{background-color:#f9f9f9;border:1px solid #ddd;text-align:center;height:25px;}
 		.tableCss th{border:1px solid #ddd;text-align:center;width:125px;height:25px;}
 	</style>
    <!-- neptune -->
   	<link rel="stylesheet" type="text/css"  href="${jypath}/static/ext/resources/ext-theme-gray/ext-theme-gray-all.css" />
	<script type="text/javascript" src="${jypath}/static/ext/ext-all.js"></script>
 	<script type="text/javascript" src="${jypath}/static/ext/locale/ext-lang-zh_CN.js"></script>
  	<script type="text/javascript" src="${jypath}/static/js/marketing/room/index.js?v=${jsVersion}"></script> 
  	<script type="text/javascript" src="${jypath}/static/js/jquery/json2.js"></script> 
    <script type="text/javascript" src="${jypath}/static/js/components/roomInfoComponent.js?v=${jsVersion}"></script> 
    <script type="text/javascript" src="${jypath}/static/js/components/batchSellControlComponent.js?v=${jsVersion}"></script> 
    <script type="text/javascript" src="${jypath}/static/js/components/batchSellCancelControlComponent.js?v=${jsVersion}"></script> 
    <script type="text/javascript" src="${jypath}/static/js/components/businessComponent.js?v=${jsVersion}"></script> 
    <script type="text/javascript" src="${jypath}/static/js/components/roomSwitchTab.js?v=${jsVersion}"></script>
    <script type="text/javascript" src="${jypath}/static/js/components/roomSwitch.js?v=${jsVersion}"></script>
  	<script type="text/javascript">
	  	var menu = '${menu}';
	  	var resourcesCode = '${menu}';
	 	var idata = '${permitBtn}';
	 	var userName = "${userName}";
	  	if(idata!=null||idata!=""){
			idata=JSON.parse(idata);
		}
		var roomWinView = true;
		var maketingRetainAdd = true;   
		var marketingPayDepositAdd = true;
		var marketingSubscribeAdd = true ; 
		var marketingSignedAdd = true ;
		var marketingSellControlAdd = true ;
		var payDepositOff = ${payDepositOff};
		
		if(Ext.Array.contains(idata,"marketing:room:view")){
			roomWinView=false;
		}
		//保留、认筹、认购、签约、销控 权限按钮控制
		if(Ext.Array.contains(idata,"marketing:retain:add")){
			maketingRetainAdd=false;
		}
		if(Ext.Array.contains(idata,"marketing:payDeposit:add")){
			marketingPayDepositAdd=false;
		}
		//marketingPayDepositAdd,true: 无权限,false: 有权限
		//payDepositOff: true: 无权限, false: 有权限
		if(!marketingPayDepositAdd && payDepositOff){
			marketingPayDepositAdd = payDepositOff;
		}
		if(Ext.Array.contains(idata,"marketing:subscribe:add")){
			marketingSubscribeAdd=false;
		}
		if(Ext.Array.contains(idata,"marketing:signed:add")){
			marketingSignedAdd=false;
		}
		if(Ext.Array.contains(idata,"marketing:sellControl:add")){
			marketingSellControlAdd=false;
		}
		
		function createTop(){
			return new Ext.create('Ext.Panel',{
	        	anchor: '100% 20%',
	        	id:'allInfoBody',
				title: '汇总信息',  
				frame: true,
				tbar:[{
			        	text:'切换至列表',
			   			icon:contextPath+'/resources/ExtJSicons/control/control_play_blue.png',
						handler:function(){
							if(treeNodeId==null){
								Ext.Msg.alert("提示","请选择左侧项目树节点!");
							}else{
								var roomSwitchList=Ext.create('component.room.switch',{
									treeId: treeNodeId
								});
								Ext.getCmp("centerBody").removeAll();
								Ext.getCmp("centerBody").add(roomSwitchList);
								$("#tab_type").val(2);
							}
						}
			        }]
			 
			});
		}
		function createButton(){
			return new Ext.create('Ext.Panel',{
				layout:'column',
				anchor: '0 0',  
	            title: '详细信息',  
	            frame: true,
	            id:'detailInfoBody',
	            autoScroll:true
			});
		}
		function createPanleInfo(treeId){
			var treePrefix = treeId.substring(0,treeId.indexOf("_"));
			var id = treeId.substring(treeId.indexOf("_")+1,treeId.length);
			var buildingId=null;
			var unitId = null;
			var roomId = null;
			var projectId = null;
			var premises = null;
			switch(treePrefix){
				case 'BUILDING':
					buildingId=id;
				  break;
				case 'UNIT':
					unitId=id;
				  break;
				case 'ROOM':
					roomId=id;
				break;
				case 'PROJECT':
					projectId=id;
					break;
				case 'PREMISES':
					premises=id;
					break;
				default:
					 break;
			}
			var paramsProportion = {
					'projectId': projectId,
					'buildingId': buildingId,
					'premisesId': premises,
					'unitId': unitId,
					'roomId': roomId,
					'resourcesCode': 'menu_0003_0001,menu_0005_0004'
			};
			Ext.Ajax.request({
				url: contextPath+'/marketing/room/findProportion',
				params:paramsProportion,
				method: 'POST',
		        callback: function (options, success, response) {
		        	var obj = JSON.parse(response.responseText);
		        	var data = obj.obj;
		        	var html = "<span><strong>认购数量占比:</strong>&nbsp;&nbsp;&nbsp;"+data.subscribeTotalRatio+"%</span><span><strong>&nbsp;&nbsp;&nbsp;认购金额:</strong>&nbsp;&nbsp;&nbsp;"+data.subscribeAmount+"&nbsp;(万元)</span>"
		        	html+="<span><strong>&nbsp;&nbsp;&nbsp;签约数量占比:</strong>&nbsp;&nbsp;&nbsp;"+data.signedTotalRatio+"%</span><span><strong>&nbsp;&nbsp;&nbsp;签约金额:</strong>"+data.signedAmount+"&nbsp;(万元)</span>";
		        	Ext.getCmp("proportionFooterLable").body.update(html);
		        }
		    });
		}
	  </script>
</head>
<body>
	<input type="hidden" id="tab_type" value="1">

</body>

</html>